package 第二章数据结构.哈希表.id841字符串哈希;

import java.util.Scanner;

public class Main {
    static int P = 131;
    //hash[i] 表示第i个字符结尾的字符串的hash值
    static int[] hash;
    //记录P的x次方
    static int[] pow;
    public static void main(String[]args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        int m = scanner.nextInt();
        scanner.nextLine();
        String s = scanner.nextLine();
        hash = new int[n+1];
        pow = new int[n+1];
        //预处理出P的次幂
        pow[0] = 1;
        for(int i = 1;i<n;i++){
            pow[i] = pow[i-1] * P;
        }
        //预处理出字符串hash
        for(int i = 1;i<=n;i++){
            char c = s.charAt(i-1);
            //这里注意不能用 c-'0'会出现整数0的情况 如"00001"
            hash[i] = hash[i-1] * P + c;
        }
        while (m -- > 0){
            int l1 = scanner.nextInt();
            int r1 = scanner.nextInt();
            int l2 = scanner.nextInt();
            int r2 = scanner.nextInt();
            if(count(l1,r1) == count(l2,r2))System.out.println("Yes");
            else System.out.println("No");
        }
    }
    //计算该段字符串的hash值
    static int count(int l, int r){
        return hash[r] - hash[l-1] * pow[r - l+1];
    }
}
